<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class Update4 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('products', function (Blueprint $table) {
            $table->boolean('is_need_address')->default(1)->after('status')->comment('是否需要收货地址');
            $table->boolean('is_free_carriage')->default(0)->index()->after('status')->comment('是否包邮');
            $table->boolean('is_offline_useable')->default(1)->after('status')->comment('是否开启线下核销');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('products', function (Blueprint $table) {
            $table->dropColumn('is_need_address');
            $table->dropColumn('is_free_carriage');
            $table->dropColumn('is_offline_useable');
        });
    }
}
